home *** CD-ROM | disk | FTP | other *** search
/ The Sunday Times: The Month 2003 December / The Sunday Times - The Month 2003-12.iso / mac / The Month DEC 03 / engine / modules / thumbs_tall.swf / scripts / frame_1 / DoAction.as
Text File  |  2003-11-10  |  3KB  |  117 lines

  1. function loadImage(mc, node, extrapath)
  2. {
  3.    extrapath != null ? 0 : (extrapath = "");
  4.    var strDefaultPath = Tardis.ASSETS_FOLDER + "images/" + Tardis.ActiveSection.id + "/";
  5.    var strImg = node.firstChild.nodeValue;
  6.    var diffpath = node.attributes.path;
  7.    if(diffpath != null)
  8.    {
  9.       strImg = diffpath + strImg;
  10.    }
  11.    else
  12.    {
  13.       strImg = strDefaultPath + extrapath + strImg;
  14.    }
  15.    strPathPrefix != null ? 0 : (strPathPrefix = "");
  16.    mc.loadMovie(strPathPrefix + strImg);
  17. }
  18. function addLink(mc)
  19. {
  20.    Links[mc.link] = mc;
  21. }
  22. function getMCfromLink(Item)
  23. {
  24.    if(Links[Item] == null)
  25.    {
  26.       var arr = [];
  27.       while(Item != sideMenu.ItemHome)
  28.       {
  29.          arr.unshift(Item._name.split("_").pop());
  30.          Item = Item._parent._parent;
  31.       }
  32.       var str = arr.join("/");
  33.       Links[Item] = Links[str];
  34.    }
  35.    return Links[Item];
  36. }
  37. function removeLinkListener()
  38. {
  39.    Tardis.sideMenu.EB.removeListener(this);
  40. }
  41. function txtOver(mc)
  42. {
  43.    mc.gotoAndStop("over");
  44.    if(blnHasPreview)
  45.    {
  46.       _parent.preview.doOver(mc.num);
  47.    }
  48.    Tardis.sideMenu.doOver(mc.link);
  49. }
  50. function txtOut(mc)
  51. {
  52.    mc.gotoAndStop("off");
  53.    if(blnHasPreview)
  54.    {
  55.       _parent.preview.doOut(mc.num);
  56.    }
  57.    Tardis.sideMenu.doOut(mc.link);
  58. }
  59. function txtUp(mc)
  60. {
  61.    Tardis.sideMenu.doUp(mc.link);
  62. }
  63. function init()
  64. {
  65.    var mcToDisplay = "clip" + nodeData.childNodes.length + "MC";
  66.    attachMovie(mcToDisplay,"mc_module",100);
  67.    trace("");
  68.    trace("attaching clip: " + mcToDisplay);
  69.    trace("");
  70.    mc_module._x = 5;
  71.    mc_module._y = 10;
  72.    var strID = Tardis.ActiveSection.id;
  73.    var Colors = Tardis.Colors;
  74.    var strColor = Colors.getString(strID);
  75.    SECTION_COLOR = Colors.getHex(strID);
  76.    DEFAULT_COLOR = Colors.getHex("default");
  77.    THUMB_PATH = nodeData.attributes.thumbpath;
  78.    play();
  79.    onComplete();
  80. }
  81. function doOver(Item)
  82. {
  83.    var mc = getMCfromLink(Item);
  84.    mc.gotoAndStop("over");
  85.    _parent.preview.doOver(mc.num);
  86. }
  87. function doOut(Item)
  88. {
  89.    var mc = getMCfromLink(Item);
  90.    mc.gotoAndStop("off");
  91.    _parent.preview.doOut(mc.num);
  92. }
  93. function positionElements(mc)
  94. {
  95.    if(nodeData.childNodes.length >= 10)
  96.    {
  97.       mc.titleFF._y = mc.imgToCheck._height - 2;
  98.    }
  99.    else
  100.    {
  101.       mc.titleFF._y = mc.imgToCheck._height;
  102.    }
  103.    mc.activeBtn._height = 96;
  104.    mc._visible = true;
  105. }
  106. Links = {};
  107. Tardis.sideMenu.EB.addListener(this);
  108. blnHasPreview = 1;
  109. stop();
  110. onReady();
  111. this.onUnload = function()
  112. {
  113.    removeLinkListener();
  114.    clearInterval(intervalID);
  115.    this.onUnload = null;
  116. };
  117.